<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../../../assets/docs.css" rel="stylesheet" type="text/css" media="screen" />
<title>MooTools 1.3 Documentation - Forms/Form.Validator.Inline</title>
</head>

<body>
  <div class="doc">
    <div class="methods">
      <h4 class="menu-item"><a href="#Form-Validator-Inline">Form.Validator.Inline</a></h4>
      <div class="menu-item"><a href="#Form-Validator-Inline:getAllAdviceMessages">getAllAdviceMessages</a></div>
      <div class="menu-item"><a href="#Form-Validator-Inline:getAdvice">getAdvice</a></div>
    </div>
    <div class="l-border r-border span-15 content">
      <h1 id="Form-Validator-Inline"><a href="#Form-Validator-Inline">Class: Form.Validator.Inline</a></h1>
      <p class="description">Evaluates an entire form against all the validators that are set up <em>displaying messages</em> in-line in the page.</p>
      <h3>Extends</h3>
      <ul>
        <li><a href="../../../docs/more/Forms/Form.Validator.html">Form.Validator</a></li>
      </ul>
      <h3>Implements</h3>
      <ul>
        <li> <a href="../../../docs/core/Class/Class.Extras.html#Options">Options</a>, <a href="../../../docs/core/Class/Class.Extras.html#Events">Events</a> </li>
      </ul>
      <h3>Syntax</h3>
      <pre class="javascript"><span class="kw2">new</span> Form.<span class="me1">Validator</span>.<span class="me1">Inline</span><span class="br0">(</span>form<span class="br0">[</span>, options<span class="br0">]</span><span class="br0">)</span>;
</pre>
      <h3>Arguments</h3>
      <ol>
        <li>form - (<em>mixed</em>) A string of the id for an Element or an Element reference of the form to evaluate</li>
        <li>options - (<em>object</em>) a key/value set of options</li>
      </ol>
      <h3>Options</h3>
      <ul>
        <li>all the options defined for <a href="../../../docs/more/Forms/Form.Validator.html">Form.Validator</a>, plus</li>
        <li>scrollToErrorsOnSubmit - (<em>boolean</em>) if <em>true</em> (the default), when the user submits the form the window (or overflown parent) will scroll up to that element so it is in view. Will use <a href="../../../docs/more/Fx/Fx.Scroll.html">Fx.Scroll</a> if it's available, otherwise it will jump to the element.</li>
        <li>scrollToErrorsOnBlur - (<em>boolean</em>) Defaults false, however if true blur events will be attached to inputs, triggering a scroll to relevant errored field.</li>
        <li>scrollToErrorsOnChange - (<em>boolean</em>) Defaults false, however if true change events will be attached to inputs, triggering a scroll to the relevant errored field.</li>
        <li>scrollFxOptions - (<em>object</em>) options for <a href="../../../docs/more/Fx/Fx.Scroll.html">Fx.Scroll</a> if it's available; used for scrolling to errors if <em>scrollToErrorsOnSubmit</em> is <em>true</em>.</li>
        <li>showAdvice - (<em>function</em>) the function used to show messages. Passed the message element which is injected into the document already and needs to have its display set to <em>block</em>. By default, this method uses [Fx.Reveal][] to smoothly show the message (if it is loaded), otherwise it just sets the display style to block.</li>
        <li>hideAdvice - (<em>function</em>) the function used to hide messages. Works exactly like the <em>showAdvice</em> option above, but instead is meant to hide the message. Uses [Fx.Reveal][] if possible, otherwise sets display to <em>none</em>.</li>
      </ul>
      <h3>Events</h3>
      <ul>
        <li>all the events defined for <a href="../../../docs/more/Forms/Form.Validator.html">Form.Validator</a>, plus</li>
        <li>onShowAdvice - (<em>function</em>) callback executed when advice is shown. Passed three arguments: an Element reference for the input being validated, an Element reference to the advice element, and the failed validator's name.</li>
        <li>onHideAdvice - (<em>function</em>) callback exectued when advice is shown. Passed three arguments: an Element reference for the input being validated, an Element reference to the advice element, and the failed validator's name.</li>
      </ul>
      <h3>Note</h3>
      <ul>
        <li>
          <p>You can define a css class-name value called <em>msgPos</em> as the id of an element into which the validation errors for that input will be inserted. Example:</p>
          <pre class="javascript">&lt;input <span class="kw2">class</span>=<span class="st0">"validate-email msgPos:'emailAdvice'"</span>&gt;
&lt;div id=<span class="st0">"emailAdvice"</span>&gt;&lt;/div&gt;
</pre>
        </li>
      </ul>
      <h2 id="Form-Validator-Inline:getAllAdviceMessages"><a href="#Form-Validator-Inline:getAllAdviceMessages">Form.Validator.Inline method: getAllAdviceMessages</a></h2>
      <p class="description">Returns all the messages that an input can produce, regardless of the user input.</p>
      <h3>Syntax</h3>
      <pre class="javascript">myFormValidator.<span class="me1">getAllAdviceMessages</span><span class="br0">(</span>field<span class="br0">[</span>, force<span class="br0">]</span><span class="br0">)</span>;
</pre>
      <h3>Arguments</h3>
      <ol>
        <li>field - (<em>mixed</em>) A string of the id for an Element or an Element reference of the input</li>
        <li>force - (<em>boolean</em>; optional) if <em>false</em>, no messages are returned if the input has the css class 'ignoreValidation'</li>
      </ol>
      <h3>Returns</h3>
      <ul>
        <li>
          <p>(<em>object</em>) An object containing information about the message. See example:</p>
          <pre class="javascript"><span class="br0">{</span>
    message: string, <span class="co1">//The message the user would see</span>
    warnOnly: boolean, <span class="co1">//true if this should just be a warning</span>
    passed: boolean, <span class="co1">//true if the current value passes validation</span>

    validator: validator <span class="co1">//the InputValidator instance</span>
<span class="br0">}</span>
</pre>
        </li>
      </ul>
      <h2 id="Form-Validator-Inline:getAdvice"><a href="#Form-Validator-Inline:getAdvice">Form.Validator method: getAdvice</a></h2>
      <p class="description">Retrieves the advice message for a field and a given validator name.</p>
      <h3>Syntax</h3>
      <pre class="javascript">myFormValidator.<span class="me1">getAdvice</span><span class="br0">(</span>field, validatorName<span class="br0">)</span>;
</pre>
      <h3>Example</h3>
      <pre class="javascript">myFormValidator.<span class="me1">getAdvice</span><span class="br0">(</span>myInput, <span class="st0">'validate-email'</span><span class="br0">)</span>;

</pre>
      <h3>Arguments</h3>
      <ol>
        <li>field - (<em>mixed</em>) A string of the id for an Element or an Element reference of the input.</li>
        <li>validatorName - (<em>string</em>) A string that represents the validator's name as it was added to <a href="../../../docs/more/Forms/Form.Validator.html">Form.Validator</a>.</li>
      </ol>
      <h3>Returns</h3>
      <ul>
        <li>(<em>element</em>) A DOM element containing the message for the user.</li>
      </ul>
    </div>
  </div>
<script type="text/javascript" src="../../../assets/mootools-core-1.3.js"></script>
<script type="text/javascript" src="../../../assets/mootools-more-smoothscroll.js"></script>
<script type="text/javascript" src="../../../assets/doc-assist.js"></script>
</body>
</html>
